package com.kxr.literetrofit;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.kxr.literetrofit.network.baseresponse.BaseResponse;
import com.kxr.literetrofit.network.request.BaseRequest;
import com.kxr.literetrofit.network.subscriber.SimpleObserver;

import java.util.HashMap;

import io.reactivex.disposables.Disposable;

public class MainActivity extends AppCompatActivity {
    Disposable disposable;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        BaseRequest.postWithJsonParams("url", new HashMap<>(), new SimpleObserver<String>() {
            @Override
            public void onSubscribe(Disposable d) {
                super.onSubscribe(d);
                disposable = d;
            }

            @Override
            protected void onSuccess(BaseResponse<String> responseBean) {
                String data = responseBean.getData();
                Log.d("LiteRetrofit", "data=="+data);
            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        disposable.dispose();
    }
}
